<?php
/**
 * User    : SHUAI
 * Email   : 953436658@qq.com
 * Referral: This is from a very handsome guy
 * control : $param
 * content : $content
 * Date: 2017/11/8
 * Time: 20:45
 */
namespace app\admin\controller;
use app\admin\model\AdminUser;
use think\captcha\Captcha;
use think\Request;

class Login
{
   public function index()
   {
       if (Request::instance()->isPost())
       {
      $data = Request::instance()->post();
     
      $admin = new AdminUser();
      $res = $admin->getFiled($data);
      //验证验证码是否正确
      $capthcha=new Captcha();
       if (!$capthcha->check($data['yzm'])){
           $this->error('验证码不正确');
       }
     if (!empty($res))
     {
         return redirect('Index/index');
     }
     else
     {
         echo '账号密码有误！';
         return redirect('index');
     }
    }
       return view('index');
   }
}